from django.shortcuts import render, redirect
from web import models
from web.forms.commodity import GoodModifyForm


def wiki(request, good_id):
    good = models.Good.objects.filter(Good_ID=good_id).first()
    formdata = {'name': good.name, 'type': good.type, 'desc': good.desc, 'stock': good.stock}
    form = GoodModifyForm(data=formdata)
    if request.method == 'GET':
        return render(request, 'wiki.html', {'good': good, 'form': form})
